# @Author ZhangGJ
# @Date 2021/11/22 11:29

import cv2.cv2 as cv2

image = cv2.imread('../images/flower.jpg')
px = image[291, 218]
print('坐标(291, 218)上的像素的BGR值是', px)

blue = image[291, 218, 0]
green = image[291, 218, 1]
red = image[291, 218, 2]
print(blue, green, red)

px = [255, 255, 255]
print('修改坐标(291, 218)上的像素的BGR值', px)

image = cv2.imread('../images/flower.jpg')
cv2.imshow('2.1', image)
for i in range(241, 292):
    for j in range(168, 219):
        image[i, j] = [255, 255, 255]
cv2.imshow('2.8', image)
cv2.waitKey(3000)
cv2.destroyAllWindows()
